const joi = require('joi');
const validationMiddleware = require('../../middleware/validate');
const { dealNotEmpty } = require('../../utils/dberrordeal');
const CollectController = require('../../controllers/good/collectController');
const router = require('koa-router')();
const { verify } = require('../../utils/auth');
router.use(verify);
router.prefix('/collect');

const rulesSchema = {
    '/collect/addcollect': joi.object({
        goodId: dealNotEmpty('商品id'),
    }),
    '/collect/cancelcollect': joi.object({
        goodId: dealNotEmpty('商品id'),
    }),
};
router.post('/addcollect', validationMiddleware(rulesSchema), CollectController.createCollect);
router.post('/cancelcollect', validationMiddleware(rulesSchema), CollectController.cancelCollect);
router.post('/getcollectlist', CollectController.getCollectList);
module.exports = router;